package com.sinothk.lab;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * 项目启动时，执行特定代码:
 * 1. 实现接口：ApplicationRunner，并实现方法：public void run(ApplicationArguments args) throws Exception
 *
 * 2. 实现接口：CommandLineRunner，并实现方法：public void run(String... args) throws Exception
 */
@SpringBootApplication
public class Boot001InitOnStartApplication implements ApplicationRunner, CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(Boot001InitOnStartApplication.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("方式1: 开机启动.....");
//        throw new BizException("1222");
    }
    @Override
    public void run(String... args) throws Exception {
        System.out.println("方式2: 开机启动.....");
//        throw new BizException("33333");
    }
}
